package com.partition.mysql.bean;

import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * 表的分区信息
 *
 * @author hexinglin
 * @created 2022-04-08 16:43
 **/
public class PartitionInfo  implements RowMapper {

    /*数据库名*/
    private String tableSchema;

    /*表名*/
    private String tableName;

    /*分区名*/
    private String partitionName;

    /*分区排序*/
    private Integer partitionOrder;

    /*分区描述,时间戳*/
    private Long partitionDescription;

    @Override
    public Object mapRow(ResultSet resultSet, int rowNum) throws SQLException {
        PartitionInfo partitionInfo = new PartitionInfo();
        partitionInfo.setTableSchema(resultSet.getString("TABLE_SCHEMA"));
        partitionInfo.setTableName(resultSet.getString("TABLE_NAME"));
        partitionInfo.setPartitionName(resultSet.getString("PARTITION_NAME"));
        partitionInfo.setPartitionOrder(resultSet.getInt("PARTITION_ORDINAL_POSITION"));
        partitionInfo.setPartitionDescription(resultSet.getLong("PARTITION_DESCRIPTION"));
        return partitionInfo;
    }

    public Long getPartitionDescription() {
        return partitionDescription;
    }

    public void setPartitionDescription(Long partitionDescription) {
        this.partitionDescription = partitionDescription;
    }

    public String getTableSchema() {
        return tableSchema;
    }

    public void setTableSchema(String tableSchema) {
        this.tableSchema = tableSchema;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getPartitionName() {
        return partitionName;
    }

    public void setPartitionName(String partitionName) {
        this.partitionName = partitionName;
    }

    public Integer getPartitionOrder() {
        return partitionOrder;
    }

    public void setPartitionOrder(Integer partitionOrder) {
        this.partitionOrder = partitionOrder;
    }
}
